class CreateEshopPreferences < ActiveRecord::Migration
  def change
    create_table :eshop_preferences do |t|
      t.string     :name, :null => false
      t.references :owner, :polymorphic => true, :null => false
      t.references :group, :polymorphic => true
      t.string     :value
      t.timestamps
    end
    
    add_index :eshop_preferences, [:owner_id, :owner_type, :name, :group_id, :group_type], :unique => true, :name => 'index_eshop_preferences_on_owner_and_name_and_preference'
  end
end